﻿@model LoginModel
@using Nop.Core
@using Nop.Core.Domain.Customers

@inject IWebHelper webHelper
@{
    Layout = "_ColumnsOne";

    //title
    Html.AddTitleParts(T("PageTitle.Login").Text);
    //page class
    Html.AppendPageCssClassParts("html-login-page");

    //register URL with return URL (if specified)
    var registerUrl = Url.RouteUrl("Register", new { returnUrl = this.Context.Request.Query["returnUrl"] }, webHelper.CurrentRequestProtocol);
}
<div class="page login-page">
    <div class="page-title">
        <h1>@T("Account.Login.Welcome")</h1>
    </div>
    @await Html.PartialAsync("_ExternalAuthentication.Errors")
    <div class="page-body">
        <div class="customer-blocks">
            @if (Model.RegistrationType == UserRegistrationType.Disabled)
            {
                <div class="new-wrapper">
                    <div class="title">
                        @T("Account.Register")
                    </div>
                    <div class="text">
                        @T("Account.Register.Result.Disabled")
                    </div>
                </div>
            }
            else if (Model.CheckoutAsGuest)
            {
                <div class="new-wrapper checkout-as-guest-or-register-block">
                    <div class="title">
                        <strong>@T("Account.Login.CheckoutAsGuestOrRegister")</strong>
                    </div>
                    <div class="text">
                        @await Component.InvokeAsync("TopicBlock", new { systemName = "CheckoutAsGuestOrRegister" })
                    </div>
                    <div class="buttons">
                        <input type="button" class="button-1 checkout-as-guest-button" onclick="location.href='@Url.RouteUrl("Checkout")'" value="@T("Account.Login.CheckoutAsGuest")" />
                        <input type="button" class="button-1 register-button" onclick="location.href='@registerUrl'" value="@T("Account.Register")" />
                    </div>
                </div>
            }
            else
            {
                <div class="new-wrapper register-block">
                    <div class="title">
                        <strong>@T("Account.Login.NewCustomer")</strong>
                    </div>
                    <div class="text">
                        @T("Account.Login.NewCustomerText")
                    </div>
                    <div class="buttons">
                        <input type="button" class="button-1 register-button" onclick="location.href='@registerUrl'" value="@T("Account.Register")" />
                    </div>
                </div>
            }
            <div class="returning-wrapper fieldset">
                <form asp-route="Login" asp-route-returnurl="@Context.Request.Query["ReturnUrl"]" method="post" autocomplete="off">
                    <div asp-validation-summary="ModelOnly" class="message-error">@T("Account.Login.Unsuccessful")</div>
                    <div class="title">
                        <strong>@T("Account.Login.ReturningCustomer")</strong>
                    </div>
                    <div class="form-fields">
                        @if (Model.UsernamesEnabled)
                        {
                            <div class="inputs">
                                <label asp-for="Username" asp-postfix=":"></label>
                                <input asp-for="Username" class="username" autofocus="autofocus" />
                                <span asp-validation-for="Username"></span>
                            </div>
                        }
                        else
                        {
                            <div class="inputs">
                                <label asp-for="Email" asp-postfix=":"></label>
                                <input asp-for="Email" class="email" autofocus="autofocus" />
                                <span asp-validation-for="Email"></span>
                            </div>
                        }
                        <div class="inputs">
                            <label asp-for="Password" asp-postfix=":"></label>
                            <input asp-for="Password" class="password" />
                            <span asp-validation-for="Password"></span>
                        </div>
                        <div class="inputs reversed">
                            <input asp-for="RememberMe" />
                            <label asp-for="RememberMe"></label>
                            <span class="forgot-password">
                                <a asp-route="PasswordRecovery">@T("Account.Login.ForgotPassword")</a>
                            </span>
                        </div>
                        @if (Model.DisplayCaptcha)
                        {
                            <nop-captcha />
                        }
                    </div>
                    <div class="buttons">
                        <input class="button-1 login-button" type="submit" value="@T("Account.Login.LoginButton")" />
                    </div>
                </form>
            </div>
        </div>
        <div class="external-authentication">
            @await Component.InvokeAsync("ExternalMethods", "ExternalAuthentication")
        </div>
        @await Component.InvokeAsync("TopicBlock", new { systemName = "LoginRegistrationInfo" })
    </div>
</div>